-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Provide explicit order for Neo4j observation customizer #47626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b5941b9
to
daa7f23
Compare
@snicoll, sorry to ping you directly. Just came across this during my testing and thought it might be useful to submit a PR. |
@injectives thanks for the PR. please amend your commit with |
At present, the `neo4jObservationCustomizer` has an effective `Ordered.LOWEST_PRECEDENCE`, meaning that it goes last in `Neo4jAutoConfiguration`: ```java configBuilderCustomizers.orderedStream().toList() ... customizers.forEach((customizer) -> customizer.customize(builder)); ``` This update sets its order to `Ordered.HIGHEST_PRECEDENCE`, meaning that a user-defined `ConfigBuilderCustomizer` can effectively override it. As an example, this is useful when user wants to customize `MicrometerObservationProvider` as it actually has some optional properties that may be useful. Here is an example: ```java @bean ConfigBuilderCustomizer observationCustomizer(ObservationRegistry observationRegistry) { return configBuilder -> { var observationProvider = MicrometerObservationProvider.builder(observationRegistry) .alwaysIncludeQuery(true) .includeQueryParameters(true) .includeUrlScheme(true) .includeUrlTemplate(true) .requestHeaderPredicate(name -> true) .responseHeaderPredicate(name -> true) .build(); configBuilder.withObservationProvider(observationProvider); }; } ``` Signed-off-by: Dmitriy Tverdiakov <[email protected]>
daa7f23
to
34b4846
Compare
Thanks! Done 👍 |
I wonder if we should use |
@wilkinsona Yes, my plan was to polish the PR to use |
There is probably no effective benefit in this as Having said this, please feel free to polish as you see fit. |
See gh-47626 Signed-off-by: Dmitriy Tverdiakov <[email protected]>
At present, the
neo4jObservationCustomizer
has an effectiveOrdered.LOWEST_PRECEDENCE
, meaning that it goes last inNeo4jAutoConfiguration
:This update sets its order to
Ordered.HIGHEST_PRECEDENCE
, meaning that a user-definedConfigBuilderCustomizer
can effectively override it.As an example, this is useful when user wants to customize
MicrometerObservationProvider
as it actually has some optional properties that may be useful. Here is an example: